package com.yjd.bi.loss.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.bi.loss.model.UserLossModel;
import com.yjd.bi.loss.service.IUserLossService;
import com.yjd.bi.loss.dao.IUserLossDao;

/**
 * <b>description</b>：流失用户数表业务实现<br>
 * <b>time</b>：2018-06-28 11:06:59 <br>
 * <b>author</b>：  weili valie.lin@foxmail.com
 */
@Service("userLossService")
public class UserLossServiceImpl extends BaseServiceImpl implements IUserLossService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public UserLossModel insert(UserLossModel model) throws Exception {
		return this.userLossDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(UserLossModel model) throws Exception {
		return this.userLossDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int delete(long id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("id", id);
		return this.userLossDao.deleteModel(paramMap, true);
	}

	/**
	 * 获取在投用户数
	 * @param paramMap
	 * @return
	 */
	public Integer getUsersInvestingCount(Map<String, Object> paramMap) throws Exception{
		return this.userLossDao.getUsersInvestingCount(paramMap);
	}

	@Resource
	private IUserLossDao userLossDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.userLossDao;
	}

}
